#pragma
#include <iostream>
#include <unordered_map>
#include <string>
#include <vector>
#include <fstream>

using namespace std;
const string unknown="未知的";
const string mydict = "./resource/Dict.txt";

class Translate
{
public:
    Translate(string dict_path=mydict):_dict_path(dict_path)
    {
        LoadDict();
    }
    void LoadDict()
    {
        ifstream in(_dict_path);
        string line;
        while(getline(in,line))
        {
            lines.push_back(line);
        }
        in.close();
    }

    void debug()
    {
        for(auto &e:lines)
        {
            cout<<e<<endl;
        }
    }
    //解析(分割)2024/10/22-21:25
    void Parse()
    {
         for(auto &line:lines)
        {

        }
    }


    string Execute(string &word)
    {
        auto iter = dict.find(word);
        if(iter==dict.end()) return unknown;
        else return dict[word];
    }

    ~Translate()
    {

    }
private:
    string _dict_path;
    unordered_map<string,string> dict;//字典 
    vector<string> lines;   
};
